package com.oceansoft.mobile.econsole.webservice.securitystaff;

import com.oceansoft.mobile.econsole.common.util.encrypt.AESUtil;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;

import javax.xml.rpc.ParameterMode;

/**
 * Created by Administrator on 2016/4/13.
 */
public class SecurityStaffService {
    private static final String wsdlUrl ="http://61.138.188.173:9080/basys/baycxWS.ws";
    private static final String nameSpaceUri = "http://tempuri.org/";
    private static SecurityStaffService instance;

    public static synchronized SecurityStaffService getInstance(){
        if(instance==null){
            instance = new SecurityStaffService();
        }
        return instance;
    }

    /**
     * 获取保安员信息
     * @return
     * @throws Exception
     */
    public String getQueryBayxx(String sfzhm,String xm) throws Exception{
        // 以下都是套路
        Service service = new Service();

        Call call = (Call) service.createCall();
        call.setTargetEndpointAddress(wsdlUrl);
        call.setOperationName("queryBayxx");// WSDL里面描述的接口名称

        call.addParameter("in0", XMLType.XSD_STRING, ParameterMode.IN);// 接口的参数
        call.addParameter("in1", XMLType.XSD_STRING, ParameterMode.IN);// 接口的参数

        call.setReturnType(XMLType.XSD_STRING);// 设置返回类型

        String result = (String) call.invoke(new Object[] { sfzhm,xm });
        String jsonObject =AESUtil.decrypt(result,"1234567890123456");
        return jsonObject;
    }


}
